# -*- coding: utf-8 -*-
import os
import time
import qianfan


def chat(message):
    os.environ["QIANFAN_AK"] = ""
    os.environ["QIANFAN_SK"] = ""

    resp = qianfan.ChatCompletion().do(messages=message, endpoint="yi_34b_chat")
    result = resp.body
    result = result['result'].decode('utf-8')
    print(result)


if __name__ == '__main__':
    while True:
        text = input("请输入你的问题：")
        message = qianfan.QfMessages()
        message.append(text)
        chat(message)
        time.sleep(1)
